/*
 * elasticforceextractor.h
 *
 *      Author: Jerome RD Soine and Christoph A Brand
 *      Institution: Schwarz goup, Institute for Theoretical Physics, Heidelberg University, Germany
 */

#ifndef FIBRETYPEEXTRACTOR_H_
#define FIBRETYPEEXTRACTOR_H_

#include "colordataextractor.h"

class FibreTypeExtractor : public ColorDataExtractor {
public:
	FibreTypeExtractor(GeomObject * G, ColorDataExtractor * additional = NULL) : ColorDataExtractor(G,additional){};

	void writeEdgesColorToFile(ofstream & fout){
		vector<Edge*> edges = *g->getEdges();
		for(unsigned int i=0; i<edges.size(); i++){
			int type = (int) edges[i]->getValueOfAttribute(ActiveCableModel::FIELD_FIBRETYPE);
			int nr = (int) edges[i]->getValueOfAttribute(ActiveCableModel::FIELD_FIBRENUMBER);
			fout << type  << " " << nr << endl;
		}
	};

	void writeFillColors(ofstream & fout){
		int numberOfTriangles = g->getTriangles()->size();
		for(int i=0; i<numberOfTriangles; i++){
			fout << 0 << endl;
		}
	};

	void writeToFile(ofstream & fout){
		fout << "SCALARS stress_fibre_type int 2" << endl << "LOOKUP_TABLE default" << endl;
		writeEdgesColorToFile(fout);
		writeFillColors(fout);
		fout << endl;
	};
};


#endif /* FIBRETYPEEXTRACTOR_H_ */
